#!/bin/bash
### BEGIN INIT INFO
# Provides:          gunicorn
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Stop/start/restart gunicorn
### END INIT INFO
# Author: kun <jk409@qq.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin

args=${1-0}
[[ $args == 0 ]] && exit 1;
if [[ $1 == 'start' ]];then
    cd /home/ubuntu/v1&&gunicorn --config /etc/gunicorn.conf run:app &
    echo '';
elif [[ $1=='stop' ]];then
    killall gunicorn;
elif [[ $1=='restart' ]];then
    killall gunicorn;
    cd /home/ubuntu/v1&&gunicorn --config /etc/gunicorn.conf run:app &
    echo '';
else
   'Error'
fi
